package com.example.observer;

/**
 * @version 1.0.0
 * @className: TestObserver
 * @description:
 * @author: rosszhang
 * @date: 2022/5/13 9:40
 */
public class TestObserver {
    public static void main(String[] args) {
        XiaoMei xiaoMei = new XiaoMei();
        XiaoLi xiaoLi = new XiaoLi();
        XiaoWang xiaoWang = new XiaoWang();

        //小王和小李在小美那里都注册了一下
        xiaoMei.addPerson(xiaoLi);
        xiaoMei.addPerson(xiaoWang);

        //小美向小王和小李发消息
        xiaoMei.notifyPerson();
    }
}
